<template>
  <lay-json-schema-form :model="form" :schema="schema1" ></lay-json-schema-form>
  <lay-button type="primary" text-align="center" @click="submit1">提交</lay-button>
</template>

<script setup>
import { ref, reactive } from 'vue';
import { layer } from '@layui/layer-vue'

const form = reactive({
  province: '',
  score: '',
  first_select: [],
  secode_select: []
})

const schema1 = reactive({
  province: {
    label: '省份',
    type: 'select',
    props: {
      options: [
        { label: '重庆', value: '1' },
        { label: '山西', value: '2' },
        { label: '四川', value: '3' },
        { label: '北京', value: '4' }
      ],
      placeholder: '请选择省份',
    }
  },
  score: {
    label: '预估分数',
    type: 'input',
    props: {
      type: 'text',
      placeholder: '请输入分数',
    }
  },
  first_select: {
    label: '首选科目',
    type: 'checkbox',
    props: {
      options: [
        {
          label: "物理",
          value: 0,
          skin: "primary"
        },
        {
          label: "历史",
          value: 1,
          skin: "primary"
        },
      ],
    }
  },
  secode_select: {
    label: '再选科目',
    type: 'checkbox',
    props: {
      options: [
        {
          label: "化学",
          value: 0,
          skin: "primary"
        },
        {
          label: "生物",
          value: 1,
          skin: "primary"
        },
        {
          label: "地理",
          value: 2,
          skin: "primary"
        },
        {
          label: "政治",
          value: 3,
          skin: "primary"
        }
      ],
    }
  },
})


const submit1 = () => {
  layer.msg(`${JSON.stringify(form)}`, { time: 2000 });
}
</script>